<template>
  <div>
    <!-- <van-overlay :show="show" @click="show = false">
      <div class="wrapper" @click.stop>
        <div class="block" />
      </div>
    </van-overlay> -->

    <div
      v-for="cinema in cinemas"
      :key="cinema.cinemaId"
      class="cinemaLists"
      @click="toCinemaInfo(cinema.cinemaId, cinema.name)"
    >
      <aside>
        <p class="nameList">{{ cinema.name }}</p>
        <p class="addressList">{{ cinema.address.slice(0, 12) }}...</p>
        <div class="cinemaTypes">
          <p class="ticketChanges">改签</p>
          <p class="discountCard">折扣卡</p>
          <p class="IMAX">IMAX厅</p>
          <p class="foreDimension">4DX厅</p>
          <p class="frameRate">60帧厅</p>
        </div>
        <div class="cardDiscount">
          <p class="card">卡</p>
          <p class="Discount">开卡特惠，9.9元气开卡</p>
        </div>
      </aside>

      <aside>
        <p class="priceList">￥{{ parseInt(Math.random() * 20 + 20) }}起</p>

        <p class="distanceList">
          {{ parseInt(Math.random() * 5 + 1) }}.{{
            parseInt(Math.random() * 5 + 1)
          }}km
        </p>
      </aside>
    </div>
  </div>
</template>

<script>
import { defineComponent } from 'vue'
import axios from 'axios'
export default defineComponent({
  data() {
    return {
      films: [],
      cinemas: []
    }
  },
  methods: {
    toCinemaInfo(cinemaId, cinemaName) {
      this.$router.push('/cinemainfo/' + 0 + cinemaId)
      this.$emit('getName', cinemaName)
    }
  },
  async created() {
    let res = await axios({
      url: 'https://m.maizuo.com/gateway?cityId=370200&ticketFlag=1&k=8791981',
      headers: {
        'X-Client-Info':
          '{"a":"3000","ch":"1002","v":"5.2.1","e":"16652866903627082701602817","bc":"370200"}',
        'X-Host': 'mall.film-ticket.cinema.list'
      }
    })
    console.log(res)
    console.log(res.data.data.cinemas)
    this.cinemas = res.data.data.cinemas
  }
})
</script>

<style lang="scss" scoped>
.cinemaTypes {
  display: flex;
  font-size: 0.005rem !important;
  justify-content: space-evenly;
  margin-top: 0.04rem;
  .ticketChanges {
    flex: auto;
    color: #589daf;
    border: 1px solid #589daf;
    border-radius: 15%;
    text-align: center;
  }
  .discountCard {
    flex: auto;
    color: rgb(246, 210, 143);
    border: 1px solid rgb(246, 210, 143);
    margin-left: 0.05rem;
    border-radius: 15%;
    text-align: center;
  }
  .IMAX {
    flex: auto;
    color: #589daf;
    border: 1px solid #589daf;
    margin-left: 0.05rem;
    border-radius: 15%;
    text-align: center;
  }
  .foreDimension {
    flex: auto;
    color: #589daf;
    border: 1px solid #589daf;
    margin-left: 0.05rem;
    border-radius: 15%;
    text-align: center;
  }
  .frameRate {
    flex: auto;
    color: #589daf;
    border: 1px solid #589daf;
    margin-left: 0.05rem;
    border-radius: 15%;
    text-align: center;
  }
}
.cinemaLists {
  list-style: none;
  font-size: 0.17rem;
  height: 1.3rem;
  display: flex;
  border-bottom: 1px solid #ccc;
  margin-right: 0.1rem;
  margin-left: 0.1rem;
  justify-content: space-between;
  align-items: center;

  .addressList {
    font-size: 0.03rem;
    color: #999;
    margin-top: 0.15rem;
  }
}
.priceList {
  color: red;
  margin-bottom: 0.3rem;
}
.distanceList {
  font-size: 0.05rem;
  margin-bottom: 0.2rem;
  color: #999;
}
.cardDiscount {
  display: flex;
  font-size: 0.1rem !important;
  margin-top: 0.07rem;
  .card {
    background: skyblue;
    color: #fff;
  }
}
</style>
